
<!--header-->
<!-- 引用头部 -->
{include file="common/top"}

<!-- 引入左侧 -->
{include file="common/left"}

<section class="rt_wrap content mCustomScrollbar">
<div class="rt_content">
	<section>
      <h2><strong style="color:grey;">产品添加页面</strong></h2>
      <div class="page_title">
       <a href="{:url('product/addProduct')}" class="fr top_rt_btn">添加新产品</a>
       <a href="{:url('product/listProduct')}" class="fr top_rt_btn">产品列表</a>
      </div>
	</section>
	<table class="table">
      	<tr>
        <th>产品名称</th>
        <th>产品添加人</th>
        <th>产品总金额</th>
        <th>产品介绍</th>
        <th>开始时间</th>
        <th>结束时间</th>
        <th>操作</th>
       </tr>
       <?php foreach($UnauditedProduct as $v){?>
       <tr>
        <td><?= $v['productName']?></td>
        <td><?= $v['adminUserName']?></td>
        <td><?= $v['totalSum']?></td>
        <td><?= $v['introduce']?></td>
        <td><?= $v['startTime']?></td>
        <td><?= $v['endTime']?></td>
        <td>
      			<select class="audit" name="" id="<?= $v['productId']?>">
      				<option value="1">审核通过</option>
      				<option value="2">审核未通过</option>
      			</select>
        </td>
       </tr>
       <?php }?>
      </table>
</div>
</section>
<script>
	$(function(){
		$(document).on('change','.audit',function()
		{
			var status = $(this).val();
			var productId = $(this).prop('id');
			obj = $(this);
			$.ajax({
				url:"{:url('product/auditProduct')}",
				data:{productId:productId,status:status},
				type:"post",
				dataType:"json",
				success:function(res)
				{
					obj.parent().parent().remove();
				}
			})
		})
	})
</script>